/**
 * 
 */
package t4j.enumerated;

enum Shrubbery{ GROUND,CRAWLING,HANGING}


public class EnumClass {
	public static void main(String[] args) {
		for(Shrubbery s:Shrubbery.values()){
			System.out.println(s + " ordinal: " + s.ordinal()); // GROUND ordinal: 0  ； 序号
			System.out.print( s.compareTo(Shrubbery.CRAWLING) + " ");//拿s和枚举比较
			System.out.print( s.equals(Shrubbery.CRAWLING) + " ");//拿s和枚举判断是否相等
			System.out.println( s == Shrubbery.CRAWLING);//拿s和枚举判断是否相等
			System.out.println( s.getDeclaringClass());//获取完整路径
			System.out.println(s.name());//打印
			System.out.println("----------------------");
		}
		
		for(String s : "HANGING CRAWLING GROUND".split(" ")){
			Shrubbery shrub = Enum.valueOf(Shrubbery.class, s);
			System.out.println(shrub);
		}
	}
}
